var pro_thumbsup = function(url, followerId, uid, itemType, spanId, btnId, iconId) {
	
	if(followerId == '1'){
	   var fingerprint = new Fingerprint({screen_resolution : true, ie_activex : true, canvas : true}).get();
	   followerId = fingerprint;
	}
	
	$.post(url, {
		"followerId" : followerId,
		"uid" : uid,
		"itemType" : itemType
	}, function(data, status) {
		if (data.code == -2) {
			alert("请登录");
			$("#logBox").overlay();
		} else {
			$("#" + spanId + " font").html("已点赞(" + data.count + ")");
			$("#" + btnId).attr("onclick",
					"javascript:pro_thumbsup_cancel('" + data.url + "','"
					+ data.followerId + "','" + data.uid + "','"
					+ data.itemType + "','" + spanId + "','" + btnId + "','" + iconId + "');return false;");
			$("#" + iconId).removeClass("fa-thumbs-o-up");
			$("#" + iconId).addClass("fa-thumbs-up");
			if (data.code == 101) {
				alert("您之前已经点过赞了哦。");
			} 
		}
	});
};

var pro_thumbsup_cancel = function(url, followerId, uid, itemType, spanId, btnId, iconId) {
	
	if(followerId == '1'){
	   var fingerprint = new Fingerprint({screen_resolution : true, ie_activex : true, canvas : true}).get();
	   followerId = fingerprint;
	}
	
	$.post(url, {
		"followerId" : followerId,
		"uid" : uid,
		"itemType" : itemType
	}, function(data, status) {
		if (data.code == -2) {
			alert("请登录");
			$("#logBox").overlay();
		} else {
			$("#" + spanId + " font").html("点赞(" + data.count + ")");
			$("#" + btnId).attr("onclick",
					"javascript:pro_thumbsup('" + data.url + "','"
					+ data.followerId + "','" + data.uid + "','"
					+ data.itemType + "','" + spanId + "','" + btnId + "','" + iconId + "');return false;");
			$("#" + iconId).removeClass("fa-thumbs-up");
			$("#" + iconId).addClass("fa-thumbs-o-up");
		}
	});
};

var pro_follow = function(url, followerId, uid, itemType, spanId, btnId, iconId) {
	$.post(url, {
		"followerId" : followerId,
		"uid" : uid,
		"itemType" : itemType
	}, function(data, status) {
		if (data.code == -2) {
			alert("请登录");
			$("#logBox").overlay();
		} else {
			if(itemType >= 2){
				$("#" + spanId + " font").text("已收藏(" + data.count + ")");				
			}else{
				$("#" + spanId + " font").text("已关注(" + data.count + ")");				
			}
			
			$("#" + btnId).attr(
					"onclick",
					"javascript:pro_unfollow('" + data.url + "','"
							+ data.followerId + "','" + data.uid + "','"
							+ data.itemType + "','" + spanId + "','" + btnId + "','" + iconId + "');return false;");
			$("#" + iconId).removeClass("fa-heart-o");
			$("#" + iconId).addClass("fa-heart");
			
			//reload for user center
			if(itemType == '0' && btnId == 'usercenter_follow_btn'){
			   location.reload();	
			}
		}
	});
};

var pro_unfollow = function(url, followerId, uid, itemType, spanId, btnId, iconId) {
	$.post(url, {
		"followerId" : followerId,
		"uid" : uid,
		"itemType" : itemType
	}, function(data, status) {
		if (data.code == -2) {
			alert("请登录");
			$("#logBox").overlay();
		} else {
			if(itemType >= 2){				
				$("#" + spanId + " font").text("收藏(" + data.count + ")");			
			}else{				
				$("#" + spanId + " font").text("关注(" + data.count + ")");		
			}
			
			$("#" + btnId).attr(
					"onclick",
					"javascript:pro_follow('" + data.url + "','"
							+ data.followerId + "','" + data.uid + "','"
							+ data.itemType + "','" + spanId + "','" + btnId + "','" + iconId  + "');return false;");
			$("#" + iconId).removeClass("fa-heart");
			$("#" + iconId).addClass("fa-heart-o");
			
			//reload for user center
			if(itemType == '0' && btnId == 'usercenter_follow_btn'){
			   location.reload();	
			}
		}
	});
}
